package com.ywjt.platformbusiness.market.integralgoods.adapter;

import android.graphics.Paint;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.Nullable;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ywjt.platformbusiness.R;
import com.ywjt.platformbusiness.market.hagglegoods.model.GroupListModel;
import com.ywjt.platformbusiness.market.integralgoods.model.IntegralListModel;

import java.util.List;

public class IntegralGoodsFragmentAdapter extends BaseQuickAdapter<IntegralListModel.ResultDTO.RecordsDTO, BaseViewHolder> {

    public IntegralGoodsFragmentAdapter(@Nullable List<IntegralListModel.ResultDTO.RecordsDTO> data) {
        super(R.layout.item_integralgoods_fragment, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, IntegralListModel.ResultDTO.RecordsDTO item) {
        ImageView ivGoodsImg=helper.getView(R.id.ivGoodsImg);
        Glide.with(mContext).load(item.getCommodityMessage().getMainPhoto())
                .into(ivGoodsImg);
        TextView tvOldPrice=helper.getView(R.id.tvOldPrice);
        tvOldPrice.getPaint().setFlags(Paint. STRIKE_THRU_TEXT_FLAG );
        helper.setText(R.id.tvOldPrice,"¥"+item.getCommodityMessage().getPrice());
        helper.setText(R.id.tvPrice,"¥"+item.getPrice());
        helper.setText(R.id.tvGoodsName,item.getCommodityMessage().getName());
        helper.setText(R.id.tvIntegral,"+"+item.getIntegral()+"积分");
    }
}